
program_name := bc 

CC := gcc
link_flags := -lev -lpthread

SRC := src/
SRC_MODULES := $(SRC)modules/

source_dirs := $(SRC) \
							 $(SRC_MODULES) \
							 $(SRC_MODULES)/common_data \
							 $(SRC_MODULES)/broker \
							 $(SRC_MODULES)/ftc \
							 $(SRC_MODULES)/tlm_srv \
							 $(SRC_MODULES)/ctl_srv	\
							 $(SRC_MODULES)/temperature \
							 $(SRC)/core

source_dirs      := $(addprefix ../,$(source_dirs))
search_wildcards := $(addsuffix /*.c,$(source_dirs))

$(program_name): $(notdir $(patsubst %.c,%.o, $(wildcard $(search_wildcards) ) ) )
	$(CC) $(link_flags) $^ -o $@ 

VPATH := $(source_dirs) 

%.o: %.c
	$(CC) -c -MD $(compile_flags) $(addprefix -I,$(source_dirs)) $<

include $(wildcard *.d)
